<!doctype html>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="../../assert_selection.js"></script>
<script>
selection_test(
  '<div contenteditable dir="ltr">|\n Just\n <span>testing \u05E8\u05E7</span>\n \u05D1\u05D5\u05D3\u05E7\n</div>',
  selection => selection.modify('extend', 'backward', 'character'),
  '<div contenteditable dir="ltr">|\n Just\n <span>testing \u05E8\u05E7</span>\n \u05D1\u05D5\u05D3\u05E7\n</div>',
  '14-0 ltr backward character');

selection_test(
  '<div contenteditable dir="ltr">\n| Just\n <span>testing \u05E8\u05E7</span>\n \u05D1\u05D5\u05D3\u05E7\n</div>',
  selection => selection.modify('extend', 'backward', 'character'),
  '<div contenteditable dir="ltr">\n| Just\n <span>testing \u05E8\u05E7</span>\n \u05D1\u05D5\u05D3\u05E7\n</div>',
  '14-1 ltr backward character');

selection_test(
  '<div contenteditable dir="ltr">\n |Just\n <span>testing \u05E8\u05E7</span>\n \u05D1\u05D5\u05D3\u05E7\n</div>',
  selection => selection.modify('extend', 'backward', 'character'),
  '<div contenteditable dir="ltr">\n |Just\n <span>testing \u05E8\u05E7</span>\n \u05D1\u05D5\u05D3\u05E7\n</div>',
  '14-2 ltr backward character');

selection_test(
  '<div contenteditable dir="ltr">\n J|ust\n <span>testing \u05E8\u05E7</span>\n \u05D1\u05D5\u05D3\u05E7\n</div>',
  selection => selection.modify('extend', 'backward', 'character'),
  '<div contenteditable dir="ltr">\n |J^ust\n <span>testing \u05E8\u05E7</span>\n \u05D1\u05D5\u05D3\u05E7\n</div>',
  '14-3 ltr backward character');

selection_test(
  '<div contenteditable dir="ltr">\n Ju|st\n <span>testing \u05E8\u05E7</span>\n \u05D1\u05D5\u05D3\u05E7\n</div>',
  selection => selection.modify('extend', 'backward', 'character'),
  '<div contenteditable dir="ltr">\n J|u^st\n <span>testing \u05E8\u05E7</span>\n \u05D1\u05D5\u05D3\u05E7\n</div>',
  '14-4 ltr backward character');

selection_test(
  '<div contenteditable dir="ltr">\n Jus|t\n <span>testing \u05E8\u05E7</span>\n \u05D1\u05D5\u05D3\u05E7\n</div>',
  selection => selection.modify('extend', 'backward', 'character'),
  '<div contenteditable dir="ltr">\n Ju|s^t\n <span>testing \u05E8\u05E7</span>\n \u05D1\u05D5\u05D3\u05E7\n</div>',
  '14-5 ltr backward character');

selection_test(
  '<div contenteditable dir="ltr">\n Just|\n <span>testing \u05E8\u05E7</span>\n \u05D1\u05D5\u05D3\u05E7\n</div>',
  selection => selection.modify('extend', 'backward', 'character'),
  '<div contenteditable dir="ltr">\n Jus|t^\n <span>testing \u05E8\u05E7</span>\n \u05D1\u05D5\u05D3\u05E7\n</div>',
  '14-6 ltr backward character');

selection_test(
  '<div contenteditable dir="ltr">\n Just\n| <span>testing \u05E8\u05E7</span>\n \u05D1\u05D5\u05D3\u05E7\n</div>',
  selection => selection.modify('extend', 'backward', 'character'),
  '<div contenteditable dir="ltr">\n Just|\n^ <span>testing \u05E8\u05E7</span>\n \u05D1\u05D5\u05D3\u05E7\n</div>',
  '14-7 ltr backward character');

selection_test(
  '<div contenteditable dir="ltr">\n Just\n <span>|testing \u05E8\u05E7</span>\n \u05D1\u05D5\u05D3\u05E7\n</div>',
  selection => selection.modify('extend', 'backward', 'character'),
  '<div contenteditable dir="ltr">\n Just|\n^ <span>testing \u05E8\u05E7</span>\n \u05D1\u05D5\u05D3\u05E7\n</div>',
  '14-8 ltr backward character');

selection_test(
  '<div contenteditable dir="ltr">\n Just\n <span>t|esting \u05E8\u05E7</span>\n \u05D1\u05D5\u05D3\u05E7\n</div>',
  selection => selection.modify('extend', 'backward', 'character'),
  '<div contenteditable dir="ltr">\n Just\n <span>|t^esting \u05E8\u05E7</span>\n \u05D1\u05D5\u05D3\u05E7\n</div>',
  '14-9 ltr backward character');

selection_test(
  '<div contenteditable dir="ltr">\n Just\n <span>te|sting \u05E8\u05E7</span>\n \u05D1\u05D5\u05D3\u05E7\n</div>',
  selection => selection.modify('extend', 'backward', 'character'),
  '<div contenteditable dir="ltr">\n Just\n <span>t|e^sting \u05E8\u05E7</span>\n \u05D1\u05D5\u05D3\u05E7\n</div>',
  '14-10 ltr backward character');

selection_test(
  '<div contenteditable dir="ltr">\n Just\n <span>tes|ting \u05E8\u05E7</span>\n \u05D1\u05D5\u05D3\u05E7\n</div>',
  selection => selection.modify('extend', 'backward', 'character'),
  '<div contenteditable dir="ltr">\n Just\n <span>te|s^ting \u05E8\u05E7</span>\n \u05D1\u05D5\u05D3\u05E7\n</div>',
  '14-11 ltr backward character');

selection_test(
  '<div contenteditable dir="ltr">\n Just\n <span>test|ing \u05E8\u05E7</span>\n \u05D1\u05D5\u05D3\u05E7\n</div>',
  selection => selection.modify('extend', 'backward', 'character'),
  '<div contenteditable dir="ltr">\n Just\n <span>tes|t^ing \u05E8\u05E7</span>\n \u05D1\u05D5\u05D3\u05E7\n</div>',
  '14-12 ltr backward character');

selection_test(
  '<div contenteditable dir="ltr">\n Just\n <span>testi|ng \u05E8\u05E7</span>\n \u05D1\u05D5\u05D3\u05E7\n</div>',
  selection => selection.modify('extend', 'backward', 'character'),
  '<div contenteditable dir="ltr">\n Just\n <span>test|i^ng \u05E8\u05E7</span>\n \u05D1\u05D5\u05D3\u05E7\n</div>',
  '14-13 ltr backward character');

selection_test(
  '<div contenteditable dir="ltr">\n Just\n <span>testin|g \u05E8\u05E7</span>\n \u05D1\u05D5\u05D3\u05E7\n</div>',
  selection => selection.modify('extend', 'backward', 'character'),
  '<div contenteditable dir="ltr">\n Just\n <span>testi|n^g \u05E8\u05E7</span>\n \u05D1\u05D5\u05D3\u05E7\n</div>',
  '14-14 ltr backward character');

selection_test(
  '<div contenteditable dir="ltr">\n Just\n <span>testing| \u05E8\u05E7</span>\n \u05D1\u05D5\u05D3\u05E7\n</div>',
  selection => selection.modify('extend', 'backward', 'character'),
  '<div contenteditable dir="ltr">\n Just\n <span>testin|g^ \u05E8\u05E7</span>\n \u05D1\u05D5\u05D3\u05E7\n</div>',
  '14-15 ltr backward character');

selection_test(
  '<div contenteditable dir="ltr">\n Just\n <span>testing |\u05E8\u05E7</span>\n \u05D1\u05D5\u05D3\u05E7\n</div>',
  selection => selection.modify('extend', 'backward', 'character'),
  '<div contenteditable dir="ltr">\n Just\n <span>testing| ^\u05E8\u05E7</span>\n \u05D1\u05D5\u05D3\u05E7\n</div>',
  '14-16 ltr backward character');

selection_test(
  '<div contenteditable dir="ltr">\n Just\n <span>testing \u05E8|\u05E7</span>\n \u05D1\u05D5\u05D3\u05E7\n</div>',
  selection => selection.modify('extend', 'backward', 'character'),
  '<div contenteditable dir="ltr">\n Just\n <span>testing |\u05E8^\u05E7</span>\n \u05D1\u05D5\u05D3\u05E7\n</div>',
  '14-17 ltr backward character');

selection_test(
  '<div contenteditable dir="ltr">\n Just\n <span>testing \u05E8\u05E7</span>|\n \u05D1\u05D5\u05D3\u05E7\n</div>',
  selection => selection.modify('extend', 'backward', 'character'),
  '<div contenteditable dir="ltr">\n Just\n <span>testing \u05E8|\u05E7^</span>\n \u05D1\u05D5\u05D3\u05E7\n</div>',
  '14-18 ltr backward character');

selection_test(
  '<div contenteditable dir="ltr">\n Just\n <span>testing \u05E8\u05E7</span>\n| \u05D1\u05D5\u05D3\u05E7\n</div>',
  selection => selection.modify('extend', 'backward', 'character'),
  '<div contenteditable dir="ltr">\n Just\n <span>testing \u05E8\u05E7</span>|\n^ \u05D1\u05D5\u05D3\u05E7\n</div>',
  '14-19 ltr backward character');

selection_test(
  '<div contenteditable dir="ltr">\n Just\n <span>testing \u05E8\u05E7</span>\n |\u05D1\u05D5\u05D3\u05E7\n</div>',
  selection => selection.modify('extend', 'backward', 'character'),
  '<div contenteditable dir="ltr">\n Just\n <span>testing \u05E8\u05E7</span>|\n^ \u05D1\u05D5\u05D3\u05E7\n</div>',
  '14-20 ltr backward character');

selection_test(
  '<div contenteditable dir="ltr">\n Just\n <span>testing \u05E8\u05E7</span>\n \u05D1|\u05D5\u05D3\u05E7\n</div>',
  selection => selection.modify('extend', 'backward', 'character'),
  '<div contenteditable dir="ltr">\n Just\n <span>testing \u05E8\u05E7</span>\n |\u05D1^\u05D5\u05D3\u05E7\n</div>',
  '14-21 ltr backward character');

selection_test(
  '<div contenteditable dir="ltr">\n Just\n <span>testing \u05E8\u05E7</span>\n \u05D1\u05D5|\u05D3\u05E7\n</div>',
  selection => selection.modify('extend', 'backward', 'character'),
  '<div contenteditable dir="ltr">\n Just\n <span>testing \u05E8\u05E7</span>\n \u05D1|\u05D5^\u05D3\u05E7\n</div>',
  '14-22 ltr backward character');

selection_test(
  '<div contenteditable dir="ltr">\n Just\n <span>testing \u05E8\u05E7</span>\n \u05D1\u05D5\u05D3|\u05E7\n</div>',
  selection => selection.modify('extend', 'backward', 'character'),
  '<div contenteditable dir="ltr">\n Just\n <span>testing \u05E8\u05E7</span>\n \u05D1\u05D5|\u05D3^\u05E7\n</div>',
  '14-23 ltr backward character');

selection_test(
  '<div contenteditable dir="ltr">\n Just\n <span>testing \u05E8\u05E7</span>\n \u05D1\u05D5\u05D3\u05E7|\n</div>',
  selection => selection.modify('extend', 'backward', 'character'),
  '<div contenteditable dir="ltr">\n Just\n <span>testing \u05E8\u05E7</span>\n \u05D1\u05D5\u05D3|\u05E7^\n</div>',
  '14-24 ltr backward character');

selection_test(
  '<div contenteditable dir="ltr">\n Just\n <span>testing \u05E8\u05E7</span>\n \u05D1\u05D5\u05D3\u05E7\n|</div>',
  selection => selection.modify('extend', 'backward', 'character'),
  '<div contenteditable dir="ltr">\n Just\n <span>testing \u05E8\u05E7</span>\n \u05D1\u05D5\u05D3|\u05E7^\n</div>',
  '14-25 ltr backward character');
</script>
